package shyvana;

import java.util.Random;

public class Deck {
	
	private final Card[] cards = new Card[52];
	private int currentCard;
	
	public Deck(){
	}
	
	public void shuffle(){
		for(int i=0; i<4; i++)
			for(int j=0; j<13; j++)
				cards[i*13+j] = new Card(j,i);
		Random r = new Random();
		for(int i=0; i<256; i++){
			int a = r.nextInt(52);
			int b = r.nextInt(52);
			Card c = cards[a];
			cards[a] = cards[b];
			cards[b] = c;
		}
		Log.instance.deckShuffle();
		currentCard = 0;
	}
	
	public Card popCard(){
		if(currentCard >= 52)
			return null;
		return cards[currentCard++];
	}
	
	
	
}
